package demo2;




public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("aaa",18);
        Student student2 = new Student("bbb",8);

        NameComparator nameComparator = new NameComparator();

        if(nameComparator.compare(student1,student2) > 0){
            System.out.println("student1 > student2");
        }else if(nameComparator.compare(student1,student2) < 0){
            System.out.println("student1 < student2");
        }else{
            System.out.println("student1 = student2");
        }
    }
    public static void main1(String[] args) {
        Student student1 = new Student("aaa",18);
        Student student2 = new Student("bbb",8);

        AgeComparator ageComparator = new AgeComparator();

        if(ageComparator.compare(student1,student2) > 0){
            System.out.println("student1 > student2");
        }else if(ageComparator.compare(student1,student2) < 0){
            System.out.println("student1 < student2");
        }else{
            System.out.println("student1 = student2");
        }
    }
}
